package com.xing.jvmsandbox.weave.test;

import com.xing.cglib.cgtest.TestEx;
import com.xing.jvmsandbox.WeaveManager;
import com.xing.jvmsandbox.event.BeforeEvent;
import com.xing.jvmsandbox.event.Event;
import com.xing.jvmsandbox.listener.EventListener;

public class Weave2Main {

    public static void main(String[] args) throws Throwable{

        EventListener eventListener = new EventListener() {
            @Override
            public void onEvent(Event event) throws Throwable {
                if(event instanceof BeforeEvent) {
                    System.err.println("hello, 我进来了啦");
                }
            }
        };

        Class<?> clazz = WeaveManager.getSingleton().weaveExten(TestEx.class, "excute", eventListener);

        System.err.println(clazz);

        TestEx testEx = (TestEx) clazz.newInstance();
        testEx.excute();

    }
}
